Repository navigation
crypto: secp256k1_allocation's control calls operator new, which -O3 keeps - #2
Merged
Merged
Conversation
…keeps The control was `delete new int(1)`, a new-expression whose allocation the standard lets the optimizer elide ([expr.new]); at variant=release, -O3 on wasip2 and wasip3 removed it, the counter did not move, and secp256k1_allocation and secp256k1_allocation_no_exceptions failed. A call of ::operator new is never elided, as webcpp::hash's allocation control already does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
test/secp256k1_allocation_test.cpp's control wasdelete new int(1). A new-expression's allocation may be elided by the optimizer ([expr.new]), and atvariant=release(-O3) on wasip2 and wasip3 it was: the counter did not move andallocations() > controlfailed, sosecp256k1_allocationandsecp256k1_allocation_no_exceptionsfailed there. The control now calls::operator delete(::operator new(sizeof(int))), a call of the replaceable function that is never elided, the form webcpp::hash's allocation control already uses.The other allocation tests of crypto (
allocation_openssl,allocation_bearssl,counting) and hash (allocation,allocation_openssl) were checked: they allocate throughvolatilepointers, direct::operator newcalls or OpenSSL's hooks, none through an elidable expression.Evidence (local, macOS arm64, wasmtime 47.0.3)
secp256k1_allocation_test.cpp(74): test 'webcpp::test::allocations() > control' failed.-a, both programs passed on each of native, wasip2, wasip3, emscripten at release and at debug (8 of 8).Test-only change, so no changelog line.
🤖 Generated with Claude Code